package query

type CombineFields struct {
	Fields   []string    `json:"fields"`
	Query    interface{} `json:"query"`
	Operator string      `json:"operator"`
}

func (g *CombineFields) Empty() bool {
	return g == nil || len(g.Fields) == 0 || IsAnyEmpty(g.Query)
}

func (g *CombineFields) Map() Map {

	vm := Map{
		"fields": g.Fields,
		"query":  g.Query,
	}

	if g.Operator != "" {
		vm["operator"] = g.Operator
	}

	return Map{"combine_fields": vm}
}
